SELECT
	YBXX_ZJYLB.name,
	t1.* 
FROM
	(
	SELECT
		root_PK_FINANCEORG,
		sum( JIE_SUAN_ZHONG_XIN ) AS JIE_SUAN_ZHONG_XIN,
		sum( CAI_WU_GONG_SI ) AS CAI_WU_GONG_SI,
		sum( WAI_BU_YIN_HANG ) AS WAI_BU_YIN_HANG,
		sum( GUO_NEI_YIN_HANG_SHOU_XIAN ) AS GUO_NEI_YIN_HANG_SHOU_XIAN,
		sum( REN_MIN_BI_ZI_JIN_YU_E ) AS REN_MIN_BI_ZI_JIN_YU_E,
		sum( YIN_HANG_CUN_KUAN_WAI_BI ) AS YIN_HANG_CUN_KUAN_WAI_BI,
		sum( XIAN_JIN ) AS XIAN_JIN,
		sum( ZI_JIN_YU_E_ZHANG_MIAN_YU_E ) AS ZI_JIN_YU_E_ZHANG_MIAN_YU_E 
	FROM
		(
		SELECT
			SUBSTR( tree_path, ( ( SELECT MIN( tree_level ) FROM YBXX_ZJYLB WHERE PK_FATHERORG = '00017710000000000PPH' ) - 1 ) * 21+1+1, 20 ) AS root_PK_FINANCEORG,
			t.* 
		FROM
			YBXX_ZJYLB t START WITH t.PK_FINANCEORG IN ( SELECT PK_FINANCEORG FROM YBXX_ZJYLB WHERE PK_FATHERORG = '00017710000000000PPH' ) CONNECT BY PRIOR t.PK_FINANCEORG = t.PK_FATHERORG 
		) 
	GROUP BY
		root_PK_FINANCEORG 
	) t1
	LEFT JOIN YBXX_ZJYLB ON t1.root_PK_FINANCEORG = YBXX_ZJYLB.PK_FINANCEORG




 create table YBXX_ZJYLB_JT AS
	SELECT
	YBXX_ZJYLB.name,
	t1.*
FROM
	(
	SELECT
		root_PK_FINANCEORG,
		sum( JIE_SUAN_ZHONG_XIN ) AS JIE_SUAN_ZHONG_XIN,
		sum( CAI_WU_GONG_SI ) AS CAI_WU_GONG_SI,
		sum( WAI_BU_YIN_HANG ) AS WAI_BU_YIN_HANG,
		sum( GUO_NEI_YIN_HANG_SHOU_XIAN ) AS GUO_NEI_YIN_HANG_SHOU_XIAN,
		sum( REN_MIN_BI_ZI_JIN_YU_E ) AS REN_MIN_BI_ZI_JIN_YU_E,
		sum( YIN_HANG_CUN_KUAN_WAI_BI ) AS YIN_HANG_CUN_KUAN_WAI_BI,
		sum( XIAN_JIN ) AS XIAN_JIN,
		sum( ZI_JIN_YU_E_ZHANG_MIAN_YU_E ) AS ZI_JIN_YU_E_ZHANG_MIAN_YU_E
	FROM
		(
		SELECT
			connect_by_root t.PK_FINANCEORG  AS root_PK_FINANCEORG,
			t.*
		FROM
			YBXX_ZJYLB t START WITH t.PK_FINANCEORG IN ( '0001A7100000002BZDQ9','0001A71000000004V4T9','0001A710000000209GQO','0001A7100000002C3SUM','0001A7100000002C0DV5',
'0001A7100000002C4ODG','0001A7100000002BZ4BH','0001A710000000001JZN','00017710000000000PRG','00017710000000000PRG',
'0001A710000000001JX3','0001A710000000001JZR','0001A7100000002BPTU1','0001A710000000001JZW','0001A7100000002C8X9D',
'0001A710000000001K00','0001A71000000025KPG3','0001A91000000001BSRA','0001A91000000001BVK3','0001A7100000002BZ0C1',
'0001A710000000055M0S','0001A71000000007RY42','0001A7100000002BZR2Z','0001A71000000029MOY0','0001A710000000001JZC',
'0001A71000000018SFVW','0001A110000000003DZV','0001A710000000001JWX','00017710000000000PSV','00017710000000000PPZ' ) CONNECT BY PRIOR t.PK_FINANCEORG = t.PK_FATHERORG
		)
	GROUP BY
		root_PK_FINANCEORG
	) t1
	LEFT JOIN YBXX_ZJYLB ON t1.root_PK_FINANCEORG = YBXX_ZJYLB.PK_FINANCEORG